import React, {  useState } from 'react'
import { Button, Space } from 'antd-mobile'
import { InfiniteScroll, List } from 'antd-mobile'
import axios from 'axios'
function Apptwo() {
    let [list,setlist]=useState([])
    let [page,setpage]=useState(1)
    const getdata= async ()=>{
        const res=await axios.get('/api/room/list')
        console.log(res);
        const data=res.data.data.list
        setlist(list.concat(data))
        setpage(page+1)
        
        
    }
    // useEffect(()=>{
    //  getdata()
    // },[])


  return (
    <div>
        <Button color='primary' fill='solid'>
            Solid
          </Button>
      {
        list&&list.map((item,index)=>{
            return<div key={index}>
                <p>{item.name}</p>
                <h2>{item.person}</h2>
            </div>
        })
      }
       <InfiniteScroll loadMore={getdata} hasMore={true} />
    </div>
  )
}

export default Apptwo
